package spms.data.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import spms.data.dao.IconDao;
import spms.data.entity.Icon;
import spms.data.service.IconService;
import spms.util.Page;

import java.util.List;


@Service
public class IconServiceImpl extends BaseServiceImpl<Icon> implements IconService {

    public final Logger log = LoggerFactory.getLogger(IconServiceImpl.class.getName());

    @Autowired
    IconDao iconDao;

    @Override
    public int count(String tableName) {
        return super.count("icon");
    }

    @Override
    public List<Icon> findAll(Class<Icon> clazz) throws Exception {
        return super.findAll(clazz);
    }

    @Override
    public List<Icon> findAll(Icon icon) throws Exception {
        return super.findAll(icon);
    }

    @Override
    public Page<Icon> findPage(int pageNum, int pageSize, Class<Icon> clazz) throws Exception {
        return super.findPage(pageNum, pageSize, clazz);
    }

    @Override
    public boolean addIcon(Icon icon) {
        try {
            iconDao.addIcon(icon);
        } catch (Exception e) {
            log.error("icon 数据保存失败：" + icon, e);
        }
        return true;
    }
}
